<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateOpenapiLogsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('openapi_logs', function (Blueprint $table) {
            $table->id();
            $table->string('interface')->index()->comment('接口');
            $table->text('parameter')->nullable()->comment('参数');
            $table->text('result')->nullable()->comment('结果');
            $table->string('method')->comment('请求方式');
            $table->timestamps();
        });

        Schema::table('customer_infos', function (Blueprint $table) {
            $table->boolean('is_push_lms')->default(false)->comment('是否推送至LMS')->after('dealer_id');
        });

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('openapi_logs');
        Schema::table('customer_infos', function (Blueprint $table) {
            $table->dropColumn('is_push_lms');
        });
    }
}
